//
//  TestCollectionPageFlowTableViewCell_7.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2022/9/30.
//  Copyright © 2022 moon. All rights reserved.
//

#import "TestCollectionPageFlowTableViewCell_7.h"

@implementation TestCollectionPageFlowTableViewCell_7


- (MenuCollectionViewCellModel *)gemAddMenuCM{
    MenuCollectionViewCellModel *cm = [[MenuCollectionViewCellModel alloc] initWithModelObject:[Menu addMenu]];
    cm.cellClass = [self.class pageCellClass];
    @MK_WEAKIFY(self);
    cm.whenClick = ^(__kindof MKUICollectionViewCellModel * _Nonnull cellModel) {
        @MK_NORMALIZE(self);
        MenuCollectionViewCellModel *cm = [self gemMenuCM:[Menu random]];
        NSIndexPath *indexpath = cellModel.indexPathInModel;
        //用于测试调用了reload方法，但layout的prepare方法并还未并调用时，就去设置中线的单元格
        [self.collectionView.model insertCellModel:cm atIndexPath:indexpath];
        [self.collectionView.model reloadCollectionViewData];
        [self.pageFlowLayout setIndexPathAtPagingCell:self.collectionView.model.indexPathOfLastCellModel animated:YES];
    };
    return cm;
}
@end
